package elearning.record.action;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

import elearning.record.entity.Browse;
import elearning.record.service.BrowseService;

public class BrowseAction extends ActionSupport implements ModelDriven<Browse>{

	private Browse browse = new Browse();
	public Browse getModel() {		
		return browse;
	}
	private Integer uid;
	private Integer videoid;
	
	public void setUid(Integer uid) {
		this.uid = uid;
	}

	public void setVideoid(Integer videoid) {
		this.videoid = videoid;
	}
	private BrowseService browseService;
	public void setBrowseService(BrowseService browseService) {
		this.browseService = browseService;
	}
	
	public void save(){	
		HttpServletResponse response = ServletActionContext.getResponse();
		HttpServletRequest request = ServletActionContext.getRequest();
		response.setCharacterEncoding("UTF-8");
		response.setHeader("Access-Control-Allow-Origin","*");
		response.setContentType("text/html;charset=utf-8");

		browseService.save(uid,videoid,browse.getVideoDot());
	}
}
